#定义全局变量
money = 5000000
name = None
name = input("请输入您的姓名：")
#定义函数
def chaxun (abc):
    if abc:
        print("_______查询余额________")
    print(f"{name},您好,您的余额剩余{money}元")
def cunkuan (cunru):
    global money
    money+=cunru
    print("_________存款_________")
    print(f"{name},您好，您存款{money}元成功")
    chaxun(False)
def qunkuan (quchu):
    global money
    money -=quchu
    print("_________取款_________")
    print(f"{name},您好，您取款{money}元成功")
    chaxun(False)
def main():
    print("_________主菜单________")
    print(f"{name}您好，欢迎来到银行ATM。请选择操作：")
    print("查询余额\t【输入1】")
    print("存款\t\t【输入2】")
    print("取款\t\t【输入3】")
    print("退出\t\t【输入4】")
    return input("请输入你的选择：")

while True:
    keyboard_input = main()
    if keyboard_input =="1":
        chaxun(True)
        continue
    elif keyboard_input =="2":
        cunru = int(input("您想要存多少钱？请输入："))
        cunkuan(cunru)
        continue
    elif keyboard_input =="3":
        quchu = int(input("您想要取多少钱？请输入："))
        qunkuan(quchu)
        continue
    else:
        print("程序退出")
        break
